home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2001 May / SGI Freeware 2001 May - Disc 3.iso / dist / fw_squid.idb / usr / freeware / squid / doc / Release-Notes-1.1.txt.z / Release-Notes-1.1.txt
Text File  |  2000-04-13  |  38KB  |  891 lines

  1. $Id: Release-Notes-1.1.txt,v 1.20 1997/07/16 20:31:50 wessels Exp $
  2.  
  3. Release Notes for version 1.1 of the Squid cache.
  4.  
  5. TABLE OF CONTENTS:
  6.  
  7.     Ident (RFC 931) lookups
  8.     URL Redirector
  9.     Reverse IP Lookups, client hostname ACLs
  10.     Cache directory structure changes
  11.         Getting true DNS TTL info into Squid's IP cache
  12.     Using a neighbor as both a parent and a sibling
  13.     Forcing your neighbors to use you as a sibling
  14.     Refresh Rules and If-Modified-Since
  15.     Overriding neighbor refresh rules
  16.     Object Purge Policy
  17.     X-Forwarded-For request header
  18.     Network Probe Database
  19.     Planning for Squid's Memory Usage
  20.     Default Parent
  21.     Cachemgr Passwords
  22.     Round-Robin IP
  23.     Store Hash Configuration Options
  24.     GNU malloc
  25.     GNU regex
  26.     Access Log Fields
  27.     Access Log Tags
  28.     Hierarchy Data Tags
  29.     Using Multicast ICP
  30.     Store.log Fields
  31.     Notes for running Squid under NEXTSTEP
  32.  
  33.  
  34. Ident (RFC 931) lookups
  35. ==============================================================================
  36. Squid will make an RFC931/ident request for client connections if
  37. 'ident_lookup' is enabled in the config file.  Currently, the ident
  38. value is only logged with the request in the access.log.  It is not
  39. currently possible to use the ident return value for access control
  40. purposes.
  41.  
  42. URL Redirector
  43. ==============================================================================
  44. Squid now has the ability to rewrite requested URLs.  Implemented
  45. as an external process (similar to a dnsserver), Squid can be
  46. configured to pass every incoming URL through a 'redirector' process 
  47. that returns either a new URL, or a blank line to indicate no change.
  48.  
  49. The redirector program is NOT a standard part of the Squid package.
  50. However there are a couple of user-contributed redirectors in the
  51. "contrib/" directory.  Since everyone has different needs, it is up to
  52. the individual administrators to write their own implementation.  For
  53. testing, and a place to start, this very simple Perl script can be
  54. used:
  55.  
  56.     #!/usr/local/bin/perl
  57.     $|=1;
  58.     print while (<>);
  59.  
  60. The redirector program must read URLs (one per line) on standard input,
  61. and write rewritten URLs or blank lines on standard output.  Note that
  62. the redirector program can not use buffered I/O.  Squid writes
  63. additional information after the URL which a redirector can use to make
  64. a decision.  The input line consists of four fields:
  65.  
  66.     URL ip-address/fqdn ident method
  67.  
  68. The ip-address is always given, the fqdn and ident fields will be given if
  69. available, or will be "-" otherwise.  Note that the ident value will only
  70. be available if 'ident_lookup' in enabled in the config file.  The
  71. request method is GET, POST, etc.
  72.  
  73. Note that when used in conjunction with the -V option (on a virtual hosted
  74. machine) this provides a mechanism to use a single Squid cache as a front
  75. end to numerous servers on different machines.  URLs written to the
  76. redirector will look like:
  77.  
  78.     http://192.0.0.1/foo
  79.     http://192.0.0.2/foo
  80.  
  81. The redirector program might be this Perl script:
  82.  
  83.     #!/usr/local/bin/perl
  84.     $|=1;
  85.     while (<>) {
  86.         s@http://192\.0\.0\.1@http://www1.foo.org@;
  87.         s@http://192\.0\.0\.2@http://www2.foo.org@;
  88.         print;
  89.     }
  90.  
  91. You may receive statistics on the redirector usage by requesting the
  92. following 'cache_object' URL:
  93.  
  94.     % client cache_object://localhost/stats/redirector
  95.  
  96.  
  97.  
  98. Reverse IP Lookups, client hostname ACLs.
  99. ==============================================================================
  100. Squid now has a address-to-hostname cache ("fqdncache") much like the
  101. name-to-address cache ("ipcache").  This means Squid can now write 
  102. client hostnames in the access log, and that client domain names can
  103. be used in ACL expressions.
  104.  
  105. If you would like to log hostnames instead of addresses, enable
  106. 'log_fqdn' in your config file.  This causes a reverse-lookup to be
  107. started just after the client connection has been accepted.  If the
  108. reverse lookup has completed by the time the entry gets logged, the
  109. fully qualified domain name will be used, otherwise the IP address
  110. is still logged.  Squid does not wait for the reverse lookup before
  111. logging the access.
  112.  
  113. A new ACL type has been added for matching client hostnames:
  114.  
  115.     acl Myusers srcdomain foo.org
  116.  
  117. The use of this ACL type may cause noticeable delay in serving objects
  118. through the cache.  However, so long as allowed clients are local, the
  119. reverse lookup should not take very long and the delay may not be
  120. noticed.
  121.  
  122. Only the FQDN (i.e. the h_name field) is used for the comparison, 
  123. host aliases are *not* checked.
  124.  
  125. If a reverse lookup fails, the word "none" will be used for the
  126. comparison.  If you wanted to deny access to clients which did not
  127. map back to valid names, you could use
  128.  
  129.     acl BadClients srcdomain none
  130.     http_access deny BadClients
  131.  
  132. NOTE: DNS has a number of known security problems.  Squid does not make
  133. any effort to guarantee the validity of data returned from gethostbyname()
  134. or gethostbyaddr() calls.
  135.  
  136.  
  137. Cache directory structure changes
  138. ==============================================================================
  139. The following improvements to the cache directory structure are due
  140. to Mark Treacy (mark@aone.com.au).
  141.  
  142. Squid-1.0 used 100 first-level directories for each 'cache_dir'.  For
  143. very large caches, this meant between 5,000-10,000 files per directory,
  144. which isn't good for performance on any unix system.  As well as the
  145. directory search times being slow, the amount of disk traffic due to
  146. directory operations was quite large (due to directory fragmentation
  147. (variable length filenames) each directory was about 100k in size).
  148.  
  149. To reduce the number of files per directory it was necessary to
  150. increase the number of directories used.  If this was done using a
  151. single level directory structure we would have a single 'cache_dir'
  152. with an excessive number of directories in it.  Hence we went to a 2
  153. level structure.  We wanted to keep each directory smaller than a
  154. filesystem block (usually 4-8k), and also wanted to be able to
  155. accommodate 1M+ objects.  Assuming approximately 256 objects per
  156. directory, we settled on 16 first-level (L1) and 256 second-level (L2)
  157. directories for a total of 16x256x256 = 1,048,576 objects.
  158.  
  159. The number of L1 and L2 directories to use is configurable in the
  160. squid.conf file (swap_level1_dirs, swap_level2_dirs).  To estimate the
  161. optimal numbers for your installation, we recommend the following
  162. formula:
  163.  
  164. given:
  165.     DS = amount of 'cache_swap' / number of 'cache_dir's
  166.     OS = avg object size = 20k
  167.     NO = objects per L2 directory = 256
  168.  
  169. calculate:
  170.     L1 = number of L1 directories
  171.     L2 = number of L2 directories
  172.  
  173. such that:
  174.     L1 x L2 = DS / OS / NO
  175.  
  176.  
  177. Getting true DNS TTL info into Squid's IP cache
  178. ==============================================================================
  179. If you have source for BIND, you can modify it as indicated in the diff
  180. below.  It causes the global variable _dns_ttl_ to be set with the TTL
  181. of the most recent lookup.  Then, when you compile Squid, the configure
  182. script will look for the _dns_ttl_ symbol in libresolv.a.  If found, 
  183. dnsserver will return the TTL value for every lookup.
  184.  
  185. This hack was contributed by Endre Balint Nagy <bne@CareNet.hu>
  186.  
  187. diff -ru bind-4.9.4-orig/res/gethnamaddr.c bind-4.9.4/res/gethnamaddr.c
  188. --- bind-4.9.4-orig/res/gethnamaddr.c    Mon Aug  5 02:31:35 1996
  189. +++ bind-4.9.4/res/gethnamaddr.c    Tue Aug 27 15:33:11 1996
  190. @@ -133,6 +133,7 @@
  191.  } align;
  192.  
  193.  extern int h_errno;
  194. +int _dns_ttl_;
  195.  
  196.  #ifdef DEBUG
  197.  static void
  198. @@ -223,6 +224,7 @@
  199.      host.h_addr_list = h_addr_ptrs;
  200.      haveanswer = 0;
  201.      had_error = 0;
  202. +    _dns_ttl_ = -1;
  203.      while (ancount-- > 0 && cp < eom && !had_error) {
  204.          n = dn_expand(answer->buf, eom, cp, bp, buflen);
  205.          if ((n < 0) || !(*name_ok)(bp)) {
  206. @@ -232,8 +234,11 @@
  207.          cp += n;            /* name */
  208.          type = _getshort(cp);
  209.           cp += INT16SZ;            /* type */
  210. -        class = _getshort(cp);
  211. -         cp += INT16SZ + INT32SZ;    /* class, TTL */
  212. +        class = _getshort(cp);  
  213. +        cp += INT16SZ;                  /* class */
  214. +        if (qtype == T_A  && type == T_A)
  215. +            _dns_ttl_ = _getlong(cp);
  216. +        cp += INT32SZ;                  /* TTL */
  217.          n = _getshort(cp);
  218.          cp += INT16SZ;            /* len */
  219.          if (class != C_IN) {
  220.  
  221.  
  222. Using a neighbor as both a parent and a sibling
  223. ==============================================================================
  224. The only difference between a sibling and a parent is that
  225. cache misses are NOT fetched from siblings.  In some cases it may be
  226. desirable to use a neighbor as a parent for some domains and as a
  227. sibling for others.  This can now be accomplished with the
  228. 'neighbor_type_domain' configuration tag.  For example:
  229.  
  230.     cache_host  parent cache.foo.org 3128 3130
  231.     neighbor_type_domain cache.foo.org sibling .com .net
  232.     neighbor_type_domain cache.foo.org sibling .au .de
  233.  
  234. Note that neighbor_type_domain is totally separate from the
  235. cache_host_domain option (which controls whether or not to query the
  236. neighbor).  In the absence of cache_host_domain restrictions, the
  237. neighbor cache.foo.org will be queried for all requests.
  238.  
  239. If the URL host domain is .com, .net, .au, or .de then cache.foo.org is
  240. treated as a sibling (and MISSES will NOT be fetched through
  241. cache.foo.org).  Otherwise it will be treated as a parent (which is the
  242. default from the cache_host line.
  243.  
  244. Forcing your neighbors to use you as a sibling
  245. ==============================================================================
  246. In a distributed cache hierarchy, you may need to force your peer
  247. caches to use you as a sibling and not a parent; ie its okay for
  248. them to fetch HITs from you, but not okay to resolve MISSes through
  249. your cache (using your resources).
  250.  
  251. This can be accomplished by using the 'miss_access' config line.  The
  252. miss_access ACL list is very similar to the 'http_access' list.  This
  253. functionality is implemented as a separate access list because when we
  254. check the http_access list, we don't yet know if the request will be a
  255. hit or miss.  The sequence of events goes something like this:
  256.  
  257.     1. accept new connection
  258.     2. read request
  259.     3. check http_access
  260.     4. process request, check for hit or miss (IMS, etc)
  261.     5. check miss_access
  262.  
  263. Note that in order to get to the point where miss_access is checked, the
  264. request must have also passed the http_access check.
  265.  
  266. You probably only want to use 'src' type ACL's with miss_access, although
  267. you can use any of the access control types.
  268.  
  269. If you are restricting your neighbors, be sure to allow miss_access
  270. to your local clients (e.g. users at browsers)!
  271.  
  272.  
  273. Refresh Rules and If-Modified-Since
  274. ==============================================================================
  275. Squid 1.1 switched from a Time-To-Live based expiration model to a
  276. Refresh-Rate model.  Objects are no longer purged from the cache when
  277. they expire.  Instead of assigning TTL's when the object enters the
  278. cache, we now check freshness requirements when objects are requested.
  279. If an object is "fresh" it is given directly to the client.  If it is
  280. "stale" then we make an If-Modified-Since request for it.
  281.  
  282. When checking the object freshness, we calculate these values:
  283.  
  284.     AGE is how much the object has aged *since* it was retrieved:
  285.                 
  286.     AGE = NOW - OBJECT_DATE
  287.  
  288.     LM_AGE is how old the object was *when* it was retrieved:
  289.  
  290.     LM_AGE = OBJECT_DATE - LAST_MODIFIED_TIME
  291.  
  292.     LM_FACTOR is the ratio of AGE to LM_AGE:
  293.  
  294.     LM_FACTOR = AGE / LM_AGE
  295.  
  296.     CLIENT_MAX_AGE is the (optional) maximum object age the client will
  297.     accept as taken from the HTTP/1.1 Cache-Control request header.
  298.  
  299.     EXPIRES is the (optional) expiry time from the server reply headers.
  300.  
  301. These values are compared with the parameters of the 'refresh_pattern'
  302. rules.  The refresh parameters are:
  303.  
  304.     URL regular expression
  305.     MIN_AGE
  306.     PERCENT
  307.     MAX_AGE
  308.  
  309. The URL regular expressions are checked in the order listed until a
  310. match is found.  Then this algorithm is applied for determining if an
  311. object is fresh or stale:
  312.  
  313.     if (CLIENT_MAX_AGE)
  314.         if (AGE > CLIENT_MAX_AGE)
  315.             return STALE
  316.     if (AGE <= MIN_AGE)
  317.         return FRESH
  318.     if (EXPIRES) {
  319.         if (EXPIRES <= NOW)
  320.             return STALE
  321.         else
  322.             return FRESH
  323.     }
  324.     if (AGE > MAX_AGE)
  325.         return STALE
  326.     if (LM_FACTOR < PERCENT)
  327.         return FRESH
  328.     return STALE
  329.  
  330. Note that the Max-Age in a client request takes the highest precedence.
  331. The 'MIN' value should normally be set to zero since it has higher
  332. precedence than the server's Expires: value.  But if you wish to
  333. override the Expires: headers, you may use the MIN value.
  334.  
  335. Overriding neighbor refresh rules
  336. ==============================================================================
  337. The refresh rules also have an effect on the requests your cache makes
  338. to its neighbors.  Squid uses the MAX_AGE value in the HTTP/1.1
  339. "Cache-Control: Max-age=nnn" request header for outgoing requests.
  340. This solves the problem where neighbors with more relaxed refresh
  341. policies would send you stale objects (by your configuration).
  342.  
  343.  
  344. Object Purge Policy
  345. ==============================================================================
  346. Squid attempts to keep the size of the disk cache relatively "smooth"
  347. or "flat."  That is, objects are removed at the same rate they are
  348. added.  Earlier versions had a "sawtooth" behavior where objects were
  349. removed only when disk space reached an upper limit.
  350.  
  351. Squid uses a Least-Recently-Used (LRU) replacement algorithm.  Objects
  352. with large LRU age values are removed before objects with small LRU age
  353. values.  We dynamically calculate the LRU age threshold, above which
  354. objects are removed.  The threshold is calculated as an exponential
  355. function between the high and low water marks.  When the store swap
  356. size is near the low water mark, the LRU threshold is large.  This
  357. encourages more objects to be cached.  When the store swap size is near
  358. the high water mark, the LRU threshold is small, encouraging more
  359. objects to be removed.  The 'reference_age' configuration parameter
  360. specifies the upper limit on the LRU age threshold.
  361.  
  362. The Squid cache storage is implemented as a hash table with some number
  363. of "hash buckets."  Squid scans one bucket at a time and sorts all the
  364. objects in the bucket by their LRU age.  Objects with an LRU age
  365. over the threshold are removed.  The scan rate is adjusted so that
  366. it takes approximately 24 hours to scan the entire cache.  The 
  367. store buckets are randomized so that we don't always scan the same
  368. buckets at the same time of the day.
  369.  
  370. If the store swap size somehow exceeds the high water mark, Squid
  371. performs an "emergency" object purge.  We sort up to 256 objects in a
  372. store bucket and remove the eight (8) least recently used ones.  This
  373. continues until the disk space is below the low water mark.
  374.  
  375. X-Forwarded-For request header
  376. ==============================================================================
  377. Squid used to add a request header called "Forwarded" which appeared
  378. in some early HTTP/1.1 draft documents.  This header had the format
  379.  
  380.     Forwarded: by cache-host for client-address
  381.  
  382. Current HTTP/1.1 draft documents instead use the "Via" header, but it
  383. does not provide any standard way of indicating the client address
  384. in the request.  Since a number of people missed having the originating
  385. client address in the request, Squid now adds its own request header
  386. called "X-Forwarded-For" which looks like this:
  387.  
  388.     X-Forwarded-For: 128.138.243.150, unknown, 192.52.106.30
  389.  
  390. Entries are always IP addresses, or the word "unknown" if the address
  391. could not be determined or if it has been disabled with the
  392. 'forwarded_for' configuration option.
  393.  
  394. We must note that access controls based on this header are extremely
  395. weak and simple to fake.  Anyone may hand-enter a request with any IP
  396. address whatsoever.  This is perhaps the reason why client IP addresses
  397. have been omitted from the HTTP/1.1 specification.
  398.  
  399.  
  400. Using ICMP to Measure the Network
  401. ==============================================================================
  402. As of version 1.1.9, Squid is able to utilize ICMP Round-Trip-Time (RTT)
  403. measurements to select the optimal location to forward a cache miss.
  404. Previously, cache misses would be forwarded to the parent cache
  405. which returned the first ICP reply message.  These were logged
  406. with FIRST_PARENT_MISS in the access.log file.  Now we can 
  407. select the parent which is closest (RTT-wise) to the origin 
  408. server.  
  409.  
  410.  1. Supporting ICMP in your Squid cache
  411.  
  412.     It is more important that your parent caches enable the ICMP
  413.     features.  If you are acting as a parent, then you may want
  414.     to enable ICMP on your cache.  Also, if your cache makes
  415.     RTT measurements, it will fetch objects directly if your 
  416.     cache is closer than any of the parents.
  417.  
  418.     If you want your Squid cache to measure RTT's to origin servers,
  419.     Squid must be compiled with the USE_ICMP option.  This is easily
  420.     accomplished by uncommenting "-DUSE_ICMP=1" in src/Makefile and
  421.     src/Makefile.in.
  422.  
  423.     An external program called 'pinger' is responsible for sending and
  424.     receiving ICMP packets.  It must run with root privileges.  After
  425.     Squid has been compiled, the pinger program must be installed
  426.     separately.  A special Makefile target will install 'pinger' with
  427.     appropriate permissions.
  428.  
  429.         % make install
  430.         % su
  431.         # make install-pinger
  432.  
  433.     There are three configuration file options for tuning the
  434.     measurement database on your cache.  'netdb_low' and 'netdb_high'
  435.     specify high and low water marks for keeping the database to a
  436.     certain size  (e.g. just like with the IP cache).  The 'netdb_ttl'
  437.     option specifies the minimum rate for pinging a site.  If
  438.     'netdb_ttl' is set to 300 seconds (5 minutes) then an ICMP packet
  439.     will not be sent to the same site more than once every five
  440.     minutes.  Note that a site is only pinged when an HTTP request for
  441.     the site is received.
  442.  
  443.     Another option, 'minimum_direct_hops' can be used to try finding
  444.     servers which are close to your cache.  If the measured hop count
  445.     to the origin server is less than or equal to minimum_direct_hops,
  446.     the request will be forwarded directly to the origin server.
  447.  
  448.  2. Utilizing your parents database
  449.  
  450.     Your parent caches can be asked to include the RTT measurements
  451.     in their ICP replies.  To do this, you must enable 'query_icmp'
  452.     in your config file:
  453.  
  454.         query_icmp on
  455.  
  456.     This causes a flag to be set in your outgoing ICP queries. 
  457.  
  458.     If your parent caches return ICMP RTT measurements then 
  459.     the eighth column of your access.log will have lines 
  460.     similar to:
  461.  
  462.         CLOSEST_PARENT_MISS/it.cache.nlanr.net
  463.  
  464.     In this case, it means that 'it.cache.nlanr.net' returned 
  465.     the lowest RTT to the origin server.  If your cache measured
  466.     a lower RTT than any of the parents, the request will
  467.     be logged with
  468.  
  469.         CLOSEST_DIRECT/www.sample.com
  470.  
  471.  
  472.  3. Inspecting the database
  473.  
  474.     The measurement database can be viewed from the cachemgr by
  475.     selecting "Network Probe Database."  Hostnames are aggregated
  476.     into /24 networks.  All measurements made are averaged over
  477.     time.  Measurements are made to specific hosts, taken from
  478.     the URLs of HTTP requests.  The recv and sent fields are the
  479.     number of ICMP packets sent and received.  At this time they
  480.     are only informational.
  481.  
  482.     A typical database entry looks something like this:
  483.  
  484.     Network          recv/sent     RTT  Hops Hostnames
  485.     192.41.10.0        20/  21    82.3   6.0 www.jisedu.org www.dozo.com 
  486.         bo.cache.nlanr.net        42.0   7.0
  487.         uc.cache.nlanr.net        48.0  10.0
  488.         pb.cache.nlanr.net        55.0  10.0
  489.         it.cache.nlanr.net       185.0  13.0
  490.  
  491.     This means we have sent 21 pings to both www.jisedu.org and
  492.     www.dozo.com.  The average RTT is 82.3 milliseconds.  The 
  493.     next four lines show the measured values from our parent
  494.     caches.  Since 'bo.cache.nlanr.net' has the lowest RTT,
  495.     it would be selected as the location to forward a request
  496.     for a www.jisedu.org or www.dozo.com URL.
  497.  
  498.  
  499. Planning for Squid's Memory Usage
  500. ==============================================================================
  501. Squid-1.1 has better memory management, although still not ideal.  
  502. Squid uses memory in a variety of ways, but the bulk of memory
  503. usage falls into two categories: per-object metadata and in-transit
  504. objects.
  505.  
  506. The per-object metadata consists of a StoreEntry data structure, plus
  507. the URL for every object your cache knows about.  This usually averages
  508. out to about 100 bytes per object.  If you assume that the objects
  509. themselves average 20 KB each, then given your disk size ('cache_swap')
  510. you need 1/200th as much for in-memory object metadata.
  511.  
  512. The other big memory use is due to in-transit objects.  The amount
  513. of memory required for this will depend on your cache's usage patterns.
  514. Obviously a more busy cache will require more memory for in-transit
  515. objects.
  516.  
  517. The 'cache_mem' parameter places a soft upper limit on the amount of
  518. memory Squid allocates for holding whole objects in VM.  The
  519. 'cache_mem' memory is allocated as a pool of 4k blocks.  Objects held
  520. in memory are stored in blocks from this pool.  The 'cache_mem_low' and
  521. 'cache_mem_high' values affect the memory reclamation algorithm.
  522.  
  523. There are two types of in-memory objects: in-transit objects and
  524. completed objects.  The in-transit objects are "locked" in memory until
  525. they are completed.  The completed objects may be either normal or
  526. "negative-cached" objects.
  527.  
  528. Whenever new memory is needed for in-transit objects and current usage
  529. is above the high water mark, Squid purges some completed objects from
  530. memory.   The in-memory objects are sorted by time of last use and then
  531. removed in order until memory usage is below the low water mark.
  532.  
  533. Occasionally Squid may need to exceed the maximum number of blocks.
  534. This will happen if all of the in-transit objects will not fit within
  535. the 'cache_mem' pool size.  You will see this warning in your cache.log
  536. file:
  537.  
  538.     WARNING: Exceeded 'cache_mem' size (4122K > 4096K)
  539.  
  540. If this warning occurs frequently then you need to consider either
  541. increasing the 'cache_mem' value or decreasing the
  542. 'maximum_object_size' value.  If the cache_mem usage is above the low
  543. water mark, then Squid will check for objects larger than
  544. 'maximum_object_size.'  Any such objects are put into "delete behind"
  545. mode which means Squid releases the section of the object which has
  546. been delivered to all clients reading from it.
  547.  
  548. As a rule-of-thumb, you should probably set 'cache_mem' to 1/3 of your
  549. machine's physical memory amount.  You can plan on another 1/3 being
  550. used by the per-object metadata.  And the final 1/3 will be used by
  551. other data structures, unaccounted memory, and malloc() overhead.
  552. Note, this assumes that the machine will be dedicated to running
  553. Squid.  If there are other services on the machine, the memory
  554. estimates should be lowered.
  555.  
  556. Default Parent
  557. ==============================================================================
  558. Squid has the ability to mark parent caches as the 'default' way to 
  559. fetch objects.  This is probably only useful with the 'no-query' option.
  560. For example, the configuration
  561.  
  562.      cache_host N1 sibling 3128 3130
  563.      cache_host N2 sibling 3128 3130
  564.      cache_host N3 sibling 3128 3130
  565.      cache_host P1 parent 3128 3130 no-query default
  566.  
  567. will result in ICP queries to sibling caches N1, N2, and N3.  If none
  568. of the siblings has the requested object then it will be retrieved
  569. through parent P1 due to the 'default' designation.  Note that
  570. 'default' does not conflict with any 'cache_host_domain' restrictions
  571. which might be placed on a neighbor.
  572.  
  573. We do not normally recommend use of the default option.  If your
  574. parent cache(s) uses ICP then you should also send them ICP queries.
  575. If your default parent is unreachable then Squid will return error
  576. messages, it will not attempt direct connections to the source.
  577.  
  578. Cachemgr Passwords
  579. ==============================================================================
  580. Squid-1.1 allows cachemgr passwords to be specified in the squid.conf
  581. file (instead of an /etc/passwd entry).  There may be a different
  582. password for each cachemgr operation, but only one password per
  583. operation.  Some sensitive operations require a password, others may be
  584. executed if no passwords are given in the squid.conf file.  Operations
  585. may be disabled by setting the password to "none." See squid.conf for a
  586. full list of cachemgr operations.
  587.  
  588. Round-Robin IP
  589. ==============================================================================
  590. When a hostname resolves to multiple IP addresses, Squid now cycles to
  591. the next address after each connection.  If a connection to an address
  592. fails, it is removed from the list.  If a hostname runs out of
  593. addresses, it is removed from the IP cache.
  594.  
  595. Store Hash Configuration Options
  596. ==============================================================================
  597. Squid's internal hash table for holding objects has a couple of
  598. configuration options (thanks to Mark Treacy).  Given the following
  599. configuration parameters:
  600.  
  601.     cache_swap
  602.     store_avg_object_size        # default 20K
  603.     store_objects_per_bucket    # default 20
  604.  
  605. We first estimate the number of objects your cache can hold:
  606.  
  607.     NUM_OBJ = cache_swap / store_avg_object_size
  608.  
  609. Then we estimate the number of hash buckets needed:
  610.  
  611.     NUM_BUCKETS = NUM_OBJ / store_objects_per_bucket
  612.  
  613. We want Squid to scan the entire hash table, one bucket at a time, over
  614. the course of about a day.  We also need NUM_BUCKETS to be a prime
  615. number for optimal distribution of the hash table.  NUM_BUCKETS is
  616. rounded off so that the number of buckets and maintenance rate are
  617. taken from this table:
  618.  
  619.     store_buckets    store_maintain_rate
  620.          7951        10 sec
  621.         12149         7 sec
  622.         16231         5 sec
  623.         33493         2 sec
  624.         65357         1 sec
  625.  
  626. If you want to increase the maintenance rate then decrease the
  627. store_objects_per_bucket parameter.
  628.  
  629. GNU malloc
  630. ==============================================================================
  631. Many users have reported significant performance improvements when Squid
  632. is linked with the GNU malloc library.  A check for 'libgnumalloc.a'
  633. has therefore been added to the configure script.  If libgnumalloc.a
  634. is found, it is automatically linked in.
  635.  
  636. GNU regex
  637. ==============================================================================
  638. Squid's configure script attempts to determine whether or not it should
  639. compile the GNU regex functions supplied in the source distribution.
  640. If your system appears to have its own POSIX compliant regex functions
  641. then configure may decide to use those instead of GNU regex.
  642.  
  643. Access Log Fields
  644. ==============================================================================
  645. The native access.log has ten (10) fields.  There is one entry here for
  646. each HTTP (client) request and each ICP Query.  HTTP requests are
  647. logged when the client socket is closed.  A single dash ('-') indicates
  648. unavailable data.
  649.  
  650.  1) Timestamp
  651.     The time when the client socket is closed.  The format is "Unix
  652.     time" (seconds since Jan 1, 1970) with millisecond resolution.
  653.  2) Elapsed Time
  654.     The elapsed time of the request, in milliseconds.  This is time
  655.     time between the accept() and close() of the client socket.
  656.  3) Client Address
  657.     The IP address of the connecting client, or the FQDN if the
  658.     'log_fqdn' option is enabled in the config file.
  659.  4) Log Tag / HTTP Code
  660.     The Log Tag describes how the request was treated locally (hit,
  661.     miss, etc).  All the tags are described below.  The HTTP code
  662.     is the reply code taken from the first line of the HTTP reply
  663.     header.  Non-HTTP requests may have zero reply codes.
  664.  5) Size
  665.     The number of bytes written to the client.
  666.  6) Request Method
  667.     The HTTP request method, or ICP_QUERY for ICP requests.
  668.  7) URL
  669.     The requested URL.
  670.  8) Ident
  671.     If 'ident_lookup' is on, this field may contain the username
  672.     associated with the client connection as derived from the
  673.     ident service.
  674.  9) Hierarchy Data / Hostname
  675.     A description of how and where the requested object was
  676.     fetched.  
  677. 10) Content Type
  678.     The Content-type field from the HTTP reply.
  679.  
  680. Access Log Tags
  681. ==============================================================================
  682. "TCP_" refers to requests on the HTTP port (3128)
  683.  
  684.         TCP_HIT            A valid copy of the requested object was
  685.                 in the cache.
  686.         TCP_MISS        The requested object was not in the cache.
  687.     TCP_REFRESH_HIT        The object was in the cache, but STALE.
  688.                 An If-Modified-Since request was made and
  689.                 a "304 Not Modified" reply was received.
  690.     TCP_REF_FAIL_HIT    The object was in the cache, but STALE.
  691.                 The request to validate the object failed,
  692.                 so the old (stale) object was returned.
  693.     TCP_REFRESH_MISS    The object was in the cache, but STALE.
  694.                 An If-Modified-Since request was made and
  695.                 the reply contained new content.
  696.     TCP_CLIENT_REFRESH    The client issued a request with the
  697.                 "no-cache" pragma.
  698.     TCP_IMS_HIT        The client issued an If-Modified-Since
  699.                 request and the object was in the cache
  700.                 and still fresh.
  701.     TCP_IMS_MISS        The client issued an If-Modified-Since
  702.                 request for a stale object.
  703.         TCP_SWAPFAIL        The object was believed to be in the cache,
  704.                 but could not be accessed.
  705.         TCP_DENIED        Access was denied for this request
  706.  
  707. "UDP_" refers to requests on the ICP port (3130)
  708.  
  709.         UDP_HIT         A valid copy of the requested object was in the cache.
  710.         UDP_HIT_OBJ     Same as UDP_HIT, but the object data was small enough
  711.                         to be sent in the UDP reply packet.  Saves the
  712.                         following TCP request.
  713.         UDP_MISS        The requested object was not in the cache.
  714.         UDP_DENIED      Access was denied for this request.
  715.         UDP_INVALID     An invalid request was received.
  716.     UDP_RELOADING    The ICP request was "refused" because the cache is
  717.             busy reloading its metadata.
  718.  
  719. "ERR_" refers to various types of errors for HTTP requests.
  720.  
  721. Hierarchy Data Tags
  722. ==============================================================================
  723.  
  724.         DIRECT                  The object has been requested from the origin
  725.                                 server.
  726.         FIREWALL_IP_DIRECT      The object has been requested from the origin
  727.                                 server because the origin host IP address is
  728.                                 inside your firewall.
  729.         FIRST_PARENT_MISS       The object has been requested from the
  730.                                 parent cache with the fastest weighted round
  731.                                 trip time.
  732.         FIRST_UP_PARENT         The object has been requested from the first
  733.                                 available parent in your list.
  734.         LOCAL_IP_DIRECT         The object has been requested from the origin
  735.                                 server because the origin host IP address 
  736.                                 matched your 'local_ip' list.
  737.         SIBLING_HIT        The object was requested from a sibling cache
  738.                                 which replied with a UDP_HIT.
  739.         NO_DIRECT_FAIL          The object could not be requested because
  740.                                 of firewall restrictions and no parent caches
  741.                                 were available.
  742.         NO_PARENT_DIRECT        The object was requested from the origin server
  743.                                 because no parent caches exist for the URL.
  744.         PARENT_HIT              The object was requested from a parent cache
  745.                                 which replied with a UDP_HIT.
  746.         SINGLE_PARENT           The object was requested from the only
  747.                                 parent cache appropriate for this URL.
  748.         SOURCE_FASTEST          The object was requested from the origin server
  749.                                 because the 'source_ping' reply arrived first.
  750.         PARENT_UDP_HIT_OBJ      The object was received in a UDP_HIT_OBJ reply
  751.                                 from a parent cache.
  752.         SIBLING_UDP_HIT_OBJ     The object was received in a UDP_HIT_OBJ reply
  753.                                 from a sibling cache.
  754.     PASSTHROUGH_PARENT    The neighbor or proxy defined in the config
  755.                 option 'passthrough_proxy' was used.
  756.     SSL_PARENT_MISS        The neighbor or proxy defined in the config
  757.                 option 'ssl_proxy' was used.
  758.     DEFAULT_PARENT        No ICP queries were sent to any parent
  759.                 caches.  This parent was chosen because
  760.                 it was marked as 'default' in the config
  761.                 file.
  762.     ROUNDROBIN_PARENT    No ICP queries were received from any parent
  763.                 caches.  This parent was chosen because
  764.                 it was marked as 'default' in the config 
  765.                 file and it had the lowest round-robin use
  766.                 count.
  767.     CLOSEST_PARENT_MISS    This parent was selected because it
  768.                 included the lowest RTT measurement to
  769.                 the origin server.  This only appears
  770.                 with 'query_icmp on' set in the config
  771.                 file.
  772.     CLOSEST_DIRECT        The object was fetched directly from the
  773.                 origin server because this cache measured
  774.                 a lower RTT than any of the parent caches.
  775.  
  776.  
  777. Almost any of these may be preceeded by 'TIMEOUT_' if the two-second
  778. (default) timeout occurs waiting for all ICP replies to arrive from
  779. neighbors.
  780.  
  781. Using Multicast ICP
  782. ==============================================================================
  783. As of Squid-1.1.6, ICP queries can be sent via multicast.  Use of multicast
  784. requires the following config file entries:
  785.  
  786.     1) A cache which wants to *receive* multicast ICP queries must
  787.        be configured to join a multicast address.  This is done with
  788.        the 'mcast_groups' directive.    For example:
  789.  
  790.     mcast_groups  224.9.9.9
  791.  
  792.     2) A cache which wants to *send* multicast ICP queries must add
  793.        a "multicast group" neighbor.  For example:
  794.  
  795.     cache_host 224.9.9.9 multicast 3128 3130 ttl=64
  796.  
  797.        In this situation, the HTTP port (3128) is ignored, but the ICP
  798.        port (3130) must be correct.  All multicast group members must
  799.        use the same ICP port number.  The 'ttl=' option specifies the
  800.        IP Multicast TTL value to be used when sending a multicast
  801.        datagram.
  802.  
  803.     3) Because Squid does not trust ICP replies received from unknown
  804.        peers, you must specify all acceptable neighbors which might
  805.        respond to your multicast query.  These appear as normal parents
  806.        or siblings, but with the special 'multicast-responder' option.
  807.        For example:
  808.  
  809.     cache_host foo.sample.com sibling 3128 3130 multicast-responder
  810.  
  811. Use of multicast creates an interesting dilemma; normally Squid sends N
  812. queries and expects N replies.  But with multicast Squid doesn't really
  813. know how many replies to expect.  Somehow Squid must know roughly how
  814. many ICP replies to expect, but at the same time it must be careful to
  815. not over-estimate and therefore incur many ICP query timeouts.
  816.  
  817. The current approach is this: Squid periodically (every 15 minutes)
  818. sends fake ICP queries to only multicast peers.  The replies are
  819. counted, up until the 'neighbor_timeout' time.  The count is averaged
  820. over time with a fast decay so that it adjusts relatively quickly.
  821. The number of replies to expect is rounded down to the nearest whole
  822. integer to minimize the chance of suffering the neighbor timeout
  823. on real ICP queries.
  824.  
  825. Store.log Fields
  826. ==============================================================================
  827. The file store.log consists of the following fields:
  828.  
  829.     time action code date lastmod expires type expect-len/real-len method key
  830.  
  831.     time       The time this entry was logged.  The value is the
  832.                raw Unix time plus milliseconds.
  833.  
  834.     action     One of RELEASE, SWAPIN, or SWAPOUT.
  835.                RELEASE means the object has been removed from the cache.
  836.                SWAPOUT means the object has been saved to disk.
  837.                SWAPIN  means the object existed on disk and has been
  838.                        swapped into memory.
  839.  
  840.     code       The HTTP reply code.
  841.  
  842.     The following three fields are timestamps parsed from the HTTP
  843.     reply headers.  All are expressed in Unix time.  A missing header
  844.     is represented with -2 and an unparsable header is represented as -1.
  845.  
  846.     date       The value of the HTTP Date reply header.  If the Date
  847.                header is missing or invalid, the time of the request
  848.                is used instead.
  849.  
  850.     lastmod    The value of the HTTP Last-Modified: reply header.
  851.  
  852.     expires    The value of the HTTP Expires: reply header.
  853.  
  854.     type       The HTTP Content-Type reply header.
  855.  
  856.     expect-len The value of the HTTP Content-Length reply header.
  857.                Zero if Content-Length was missing.
  858.  
  859.     real-len   The number of bytes of content actually read.  If the
  860.                expect-len is non-zero, and not equal to the real-len,
  861.                the object will be released from the cache.
  862.  
  863.     method     HTTP request method
  864.  
  865.     key        The cache key.  Often this is simply the URL.  Cache objects
  866.                which never become public will have cache keys that include
  867.                a unique integer sequence number, the request method, and
  868.                then the URL.
  869.  
  870.  
  871. Notes for running Squid under NEXTSTEP
  872. ==============================================================================
  873. When running Squid under NEXTSTEP 3.x, and when that NEXTSTEP system
  874. runs a BIND named process (most NEXTSTEPS handle that through netinfo
  875. and netinfo might contact a BIND named on another system) squid can
  876. trigger an error in the older BIND named that comes with NEXTSTEP 3.x.
  877. It is therefore necessary for systems running NEXTSTEP 3.x, which run
  878. their own BIND named, to run a more recent version of BIND. Luckily you
  879. don't have to compile BIND yourself, a fat (m68k i486 hppa sparc)
  880. Installer package for BIND-4.9.5 is available through
  881. ftp://ftp.nluug.nl/pub/comp/next/Internet.
  882.  
  883. NB: It might be necessary to have BIND running to run Squid under
  884. NEXTSTEP releases before NEXTSTEP 3.3+patch. Earlier releases of
  885. NEXTSTEP did not have a multithreaded netinfo resolver, which means
  886. that Squid's use of multiple dnsserver processes to prevent blocking is
  887. thwarted by netinfo blocking on every request.
  888.  
  889. Gerben Wierda <Gerben_Wierda@RnA.nl>
  890.  
  891.